#ifndef EDITORWINDOW_H
#define EDITORWINDOW_H
#include"EditorWidgets/settingwidget.h"
#include"Render/renderwidget.h"
#include <QMainWindow>
#include <qbuttongroup.h>
#include <ResourceManger/filepreviewwidget.h>
#include <ResourceManger/resourceswidget.h>
#include "gamemanager.h"
#include "Narration/narrationwidgettool.h"
#include "Render/renderparent.h"
#include "EditorWidgets/menuwidget.h"
#include "UIEditor/uieditorwidget.h"
#include "GameUI/uimanager.h"
#include "EditorWidgets/imageeditwidget.h"
QT_BEGIN_NAMESPACE
namespace Ui { class EditorWindow; }
QT_END_NAMESPACE

class EditorWindow : public QMainWindow
{
    Q_OBJECT

public:
    EditorWindow(const EditorWindow&) = delete;
    EditorWindow& operator = (const EditorWindow&) = delete;
    static EditorWindow& Instance();
    ~EditorWindow();
protected:
    void keyPressEvent(QKeyEvent *event);
private:
    EditorWindow();
    void Init();
    void InitWidgets();
    void InitToolBtns();
    void InitMenuBtns();
    void InitEditToolBtns();
    void InitHideUI();

    SettingWidget* settingWidget;
    RenderParent* renderParent;
    RenderWidget* renderWidget;
    QButtonGroup* btnGroup;
    ResourcesWidget* resourceWidget;
    FilePreviewWidget *filePreviewWidget;
    QDockWidget *narrativeDockWidget;
    QDockWidget *filePreviewWidgetParent = nullptr;
    MenuWidget *menuWidget;
    UIEditorWidget* uiEditWidget;
    ImageEditWidget* imageEditWidget;
    QDockWidget* imageEditorParent;
    Ui::EditorWindow *ui;
    float minWidth = 1600.0f,minHeight = 1200.0f;
    void ReleaseMode(bool release = true);
    void DisableSizeSlider(bool disable);
    void RunBtn(bool runHere = false);
    //隐藏除了渲染窗口外的所有窗口
    void HideWidgets();
public slots:
    void RunAsAGame();
    void Release();
};
#endif // EDITORWINDOW_H
